using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Data;
using System.Web;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class AllCity : Shop, IRequiresSessionState
{
	protected LinkButton LinkButton1;
	protected LinkButton LinkButton2;
	protected LinkButton LinkButton3;
	protected LinkButton LinkButton4;
	protected LinkButton LinkButton5;
	protected LinkButton LinkButton6;
	protected LinkButton LinkButton7;
	protected LinkButton LinkButton8;
	protected Repeater Repeater_Province;
	protected HtmlForm form1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Init(object sender, EventArgs e)
	{
		try
		{
			Template.BindTemplateToPage(this.Page, "SaleProduct");
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		SiteConfigBll siteConfigBll = new SiteConfigBll();
		if (siteConfigBll.GetSiteString("SiteConfigInfo/CityArea") == "0")
		{
			this.WriteErrMsg("", "该网页尚未开启！", "");
		}
		else
		{
			base.ShowCityArea();
		}
		if (!base.IsPostBack)
		{
			this.ProvinceBind();
		}
	}
	protected void ProvinceBind()
	{
		Shop_City shop_City = new Shop_City(this.conn);
		this.Repeater_Province.DataSource = shop_City.GetAllProvince();
		this.Repeater_Province.DataBind();
	}
	protected void Repeater_Province_ItemDataBound(object sender, RepeaterItemEventArgs e)
	{
		if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
		{
			DataRowView dataRowView = e.Item.DataItem as DataRowView;
			string province = dataRowView["Province"].ToString();
			Shop_City shop_City = new Shop_City(this.conn);
			Repeater repeater = (Repeater)e.Item.FindControl("Repeater_City");
			repeater.DataSource = shop_City.GetCityByWhere(province, "", 1);
			repeater.DataBind();
		}
	}
	protected void Repeater_Province_ItemCommand(object source, RepeaterCommandEventArgs e)
	{
		this.CreateCookie(e.CommandArgument.ToString(), "Province");
	}
	protected void Repeater_City_ItemCommand(object source, RepeaterCommandEventArgs e)
	{
		this.CreateCookie(e.CommandArgument.ToString(), "City");
	}
	protected void CreateCookie(string strName, string strModel)
	{
		HttpCookie httpCookie = new HttpCookie("Howave_City");
		httpCookie.Values.Add("_Name", base.Server.UrlEncode(strName));
		httpCookie.Values.Add("_Model", strModel);
		httpCookie.Expires = DateTime.Now.AddDays(30.0);
		base.Response.Cookies.Add(httpCookie);
		base.Response.Redirect(Fetch.Get("doGet"));
	}
	protected void LinkButton1_Command(object sender, CommandEventArgs e)
	{
		this.CreateCookie(e.CommandArgument.ToString(), "Province");
		base.Response.Redirect(Fetch.Get("doGet"));
	}
}
